package com.wardrobe.soa.common;

import com.google.common.cache.CacheBuilder;

/**
 * Created by m1304 on 2018/8/15.
 */
public class LoadingCacheManager {

    public static CacheBuilder<Object, Object> initBuilder(){
        return initBuilder(true);
    }
    public static CacheBuilder<Object, Object> initBuilder(boolean setDefaultConcurrency){
        CacheBuilder<Object, Object> builder =  CacheBuilder.newBuilder().recordStats();
        if(setDefaultConcurrency) {
            builder.concurrencyLevel(16);
        }
        return builder;
    }
}
